package com.hhj.demo.dongwu;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * Created by KING on 2018/7/17.
 */
@Setter
@Getter
public class Person extends Animal implements AnimalAction, ApplicationContextAware {
    private String niceName = "Person";
    private String str;
    private static ApplicationContext applicationContext;

    public Person() {
        System.out.println("create bean! ");
    }

    public Person(String str1) {
        this.str = str1;
        System.out.println(str);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public static Object getBean(String name) throws BeansException {
        return applicationContext.getBean(name);
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }


    @Override
    public int makeMoney() {
        return 0;
    }

    @Override
    public int spendMoney() {
        return 0;
    }

    @Override
    public String eatMeal() {
        return null;
    }

    @Override
    public String reduceMeal() {
        return null;
    }
}
